'use strict';

//项目主入口模块
angular.module('appModule', [
	'ui.router',
	'listModule.controller',
	'detailModule.controller',
	'config',
	'crossModule.service'
])
	.controller('appController',["$scope", function ($scope) {
		$scope.change= function () {};
		$scope.$on('list-to-app', function (event,fn) {
			console.log(fn)
			console.log(event);
			$scope.change=fn;
		})
		$scope.$watch('search',function(){
			$scope.change($scope.search);
		})


	}])
	.config(['$stateProvider','$urlRouterProvider' ,function ($stateProvider,$urlRouterProvider) {
		$stateProvider
			.state('list',{
				url:'/list/:type',
				templateUrl:'./areas/list/list.html',
				controller:'listController'
			})
			.state('detail',{
				url:'/detail/:type',
				templateUrl:'./areas/detail/detail.html',
				controller:'detailController'
			})
		$urlRouterProvider.otherwise('/list/in_theaters');
	}]);
